﻿#ifndef PST_DialogTransferFunction_H
#define PST_DialogTransferFunction_H

#include <IdaDialogFrame>
#include <QModelIndexList>
#include <QStringListModel>
QT_BEGIN_NAMESPACE
namespace Ui
{
    class DialogTransferFunction;
};
QT_END_NAMESPACE

namespace pst
{
    class DataChosenListDialog;
    class DialogTransferFunction : public IdaDialogFrame
    {
        Q_OBJECT

    public:
        DialogTransferFunction(QWidget* parent = nullptr);
        ~DialogTransferFunction();
        void setCurveNameList(const QList<QString>& curveNameList);

        void setInit(QStringList& params);

    signals:
        void signal_sendSelectInfo(const QString& graphName, const QString& calibrationGraphName, const QString& type);

    public slots:
        void on_pushButton_confirm_clicked();
        void on_pushButton_cancel_clicked();

        void on_comboBox_TransferFunctionType_currentIndexChanged(int index);
        void on_pushButton_Curve_clicked();            // 电流或场强曲线选择按钮点击
        void on_pushButton_CalibrationCurve_clicked(); // 电场曲线选择按钮点击

        void slot_sentChosenDataIds(const QModelIndexList& chosenID);
        void slot_sentCalibrationChosenDataIds(const QModelIndexList& chosenID);

    private:
        void pushButtonConfirmStateUpdata(); // 判断是否可以确认
        QModelIndexList createSelectedIndexes(const QStringList& params);

    private:
        Ui::DialogTransferFunction* ui;
        int m_transferFunctionType = 0;
        DataChosenListDialog* m_dataChosenListDialog;
        DataChosenListDialog* m_dataChosenListDialogCalibration;
        QList<QString> m_curveNameList;
        QList<int> m_CurrentSelectedIndexs;       // 感应电流选中曲线索引列表
        QList<int> m_FieldStrengthSelectedIndexs; // 场强选中曲线索引列表
        QList<int> m_CalibrationSelectedIndexs;   // 校准电场选中曲线索引列表

        bool m_canConfirm{false};

        QStringListModel m_model;
        bool m_edit;
    };
} // namespace pst

#endif
